﻿{include file="/public/header" /}
<div class="content-wraper full">
    <div class="r-panel-header" style="margin-top: 20px;"><span class="panel-tit">门店二维码打包</span></div>
    <div style="margin-top:20px;">
        <button type="button" data-key="tozip" class="btn btn-primary large" style="margin-left:15px;">打包</button>
        <button type="button" data-key="download" data-file="{$isfile ?? 0}" class="btn {if $isfile}btn-primary{else}btn-cancel{/if} large" style="margin-left:15px;">下载</button>
    </div>
    <div class="r-panel-header" style="margin-top: 20px;"><span class="panel-tit">全店销售停职</span></div>
    <div style="margin-top:20px;">
        <button type="button" data-key="tingzhi" class="btn btn-primary large" style="margin-left:15px;">停职</button>
    </div>
</div>
<script type="text/javascript">
$(document).ready(function(){
    $(':button[data-key="tozip"].btn-primary').click(function(){
        $(this).text('打包中...');
        $(this).removeClass('btn-primary');
        $(this).addClass('btn-cancel');
        $.ajax({type : "POST",dataType: "json",cache : false, url : "{$_G['_mc_'] ?? ''}/tozip?r="+Math.random(),success: function(json){
            try{
                if (json.state != 'y') {
                    Core.Dialog.msg(json.msg || '打包二维码文件失败');
                } else {
                    window.location.reload();
                }
            }catch(e){Core.Dialog.msg('打包接口错误');return false;}
        }});
    });
    $(':button[data-key="download"].btn-primary').click(function(){
        window.location.href = "{$_G['_mc_'] ?? ''}/download?r="+Math.random()
    });
    $(':button[data-key="tingzhi"].btn-primary').click(function(){
        $(this).text('停职中...');
        $(this).removeClass('btn-primary');
        $(this).addClass('btn-cancel');
        $.ajax({type : "POST",dataType: "json",async : false,cache : false, url : "{$_G['_mc_'] ?? ''}/tingzhi?r="+Math.random(),success: function(json){
            try{
                if (json.state != 'y') {
                    Core.Dialog.msg(json.msg || '操作失败');
                } else {
                    window.location.reload();
                }
            }catch(e){Core.Dialog.msg('接口错误');return false;}
        }});
    });
});
</script>
{include file="/public/footer" /}